#include <bits/stdc++.h>

using namespace std;

class Solution
{
public:
    long long waysToBuyPensPencils(int total, int cost1, int cost2)
    {
        long long ret = 0;
        int mx = max(cost1, cost2);
        int mi = min(cost1, cost2);
        int cost = 0;
        while (cost <= total)
        {
            ret += (total - cost) / mi + 1;
            cost += mx;
        }
        return ret;
    }
};